package parse

import (
	"encoding/json"
	"study5/jysp/model"
)

type Parser struct{
	receiver <-chan []byte

}

func NewParser(rec <-chan []byte) *Parser{
	return &Parser{
		receiver:rec,
	}
}

func (p *Parser) StartParse() (list []*model.ListUserInfo,err error){
	buf := <- p.receiver
	pm := new(model.PageModel)
	err = json.Unmarshal(buf,pm)
	if err != nil{
		return
	}
	list = pm.UserInfo
	return
}